/*
 * threadGenThumb.java
 *
 * Created on 1. duben 2004, 0:10
 */

package cz.masa.FotoCAT;

import java.sql.*;
import javax.swing.*;

/**
 *
 * @author  Administrator
 */
public class threadGenThumb extends Thread {
    fcaDirectory fcaDir;
    
    /** Creates a new instance of threadGenThumb */
    public threadGenThumb(fcaDirectory fcaDir){
        this.fcaDir = fcaDir;
    }
    
    public void run(){
        int count_all = fcaDir.loadImages();
        int count_ok = 0;
        
        for(int i = 0; i < fcaDir.images.size(); i++){
            fcaImage img = (fcaImage)fcaDir.images.elementAt(i);
            FotoCAT.setStatusString("Generating thumbnail " + (i + 1) + " / " + count_all + ": " + img.getFilename());
            if(img.regenerateThumbnail() == 1) count_ok++;
        }
        
        FotoCAT.setStatusString("");
        JOptionPane.showInternalMessageDialog(FotoCAT.desktop, "Regeneration of thumbnails was completed.\nImages count: " + count_all + "\nSuccess: " + count_ok, "Info", JOptionPane.INFORMATION_MESSAGE);
    }
    
}
